package com.cn.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.cn.model.CarDetail;


/**
 * 用户模型MAPPER
 * 
 * @author yp
 */
@Mapper
public interface CarMapper {
	
	
	
	/**
	 * 获取所有二手车信息
	 * 
	 * @param user
	 */
	@Select("select * from t_car")
	List< CarDetail> queryAllUser();	
	
	/**
	 * 获取详细二手车信息
	 * 
	 * @param user
	 */
	@Select("select * from t_car where username = #{id}")
	CarDetail queryCar(String id);
	
	/**
	 * 添加二手车信息
	 * 
	 * @param user
	 */
	@Insert("insert into t_car(buyYear,nprice,oldprice) value ( #{buyYear},#{nprice},#{oldprice} ) ")
	void addCar(CarDetail car);
	
	/**
	 * 修改车辆
	 * 
	 * @param user
	 */
	@Update("update t_car set mobile = #{id},password = #{password},nickname = #{nickname},birth = #{birth},sex = #{sex},height = #{height},weight = #{weight},illcode = #{illcode},edittime = now()  where devicenum = #{devicenum}")
	void editCar(CarDetail user);
	
}